<template>
  <upload-excel :on-success="handleSuccess" />
</template>

<script>
import { importEmployee } from '@/api/employees'
import { getImportData } from '@/utils/excelData'
export default {
  name: 'Import',
  methods: {
    async handleSuccess({ header, results }) {
      // 处理数据
      const newArr = getImportData(results)
      // 调用导入接口
      await importEmployee(newArr)
      this.$router.back()
    }
  }
}
</script>
